<template>
  <!--
    	作者：luoyiming
    	时间：2020-04-26
    	描述：备注-编辑备注
    -->
  <div class="product-add">
    <!--form表单-->
    <el-form size="small" ref="form" :model="form" label-width="80px">
      <!--编辑备注-->
      <div class="common-form">编辑</div>
      <el-form-item label="备注" prop="title" :rules="[{required: true,message: ' '}]">
        <el-input v-model="form.title" placeholder="请输入备注" class="max-w460"></el-input>
      </el-form-item>
     
    
  
      <!--提交-->
      <div class="common-button-wrapper">
        <el-button size="small" type="info" @click="cancelFunc">取消</el-button>
        <el-button size="small" type="primary" @click="onSubmit" :loading="loading">提交</el-button>
      </div>
    </el-form>
   
  </div>
</template>

<script>

import StoreApi from '@/api/store.js';
import Upload from '@/components/file/Upload';
import {formatModel} from '@/utils/base.js'

export default {
  components: {
    Upload
  },
  data() {
    return {
      remarkAreaDialog: false,
      mapOpen: false,
      /*form表单数据*/
      form: {
        id: null,
        title: '',
       
      },
      
    };
  },

  created() {

    this.form.id = this.$route.query.id;

    this.getData();
  },
  methods: {
    
    /*修改*/
    onSubmit() {
      let self = this;
      let form = self.form;
      self.$refs.form.validate((valid) => {
        if (valid) {
          self.loading = true;
          StoreApi.editremarks(form, true)
            .then(data => {
              self.loading = false;
              self.$message({
                message: '恭喜你，备注修改成功',
                type: 'success'
              });
              self.$router.push('/store/remarks/index');
            }).catch(error => {
            self.loading = false;
          });
        }
      });
    },

    /*获取参数*/
    getData() {
      let self = this;
      StoreApi.remarksDetail({
        id: self.form.id
      }, true)
        .then(res => {
          self.form = formatModel(self.form, res.data.model);
        
        })
        .catch(error => {

        });

    },

  }

};
</script>

<style lang="scss" scoped>
.basic-setting-content {
}

.product-add {
  padding-bottom: 50px;
}

.img {
  margin-top: 10px;
}

</style>
<style lang="scss">
.dialog-footer-at-remark-map{
  width: 100%;
  display: flex;
  justify-content: flex-end;
  margin-top: 30px;
}
</style>